package vip.pwztx.controller;

import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.pwztx.constant.Constant;
import vip.pwztx.entity.Result;
import vip.pwztx.service.CloudApiService;

/**
 * 云盘接口
 *
 * @author zhoubaohua
 * @date 2020/8/28
 */
@Api(tags = "云盘接口")
@RestController(Constant.API_PREFIX + "/cloud")
public class CloudApiController {

    private final CloudApiService cloudApiService;

    public CloudApiController(CloudApiService cloudApiService) {
        this.cloudApiService = cloudApiService;
    }

    /**
     * 获取蓝奏云下载地址
     *
     * @param url      分享地址
     * @param password 分享密码
     * @return 下载地址
     * @throws Exception 异常
     */
    @ApiOperation("获取蓝奏云下载地址")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "url", value = "分享地址"),
            @ApiImplicitParam(name = "password", value = "分享密码")
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功")
    })
    @GetMapping("/lanZouYun/download/url")
    public Result getLanZouYunDownloadUrl(String url, String password) throws Exception {
        return Result.ofSuccess(cloudApiService.getLanZouYunDownloadUrl(url, password));
    }
}
